﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;

namespace WPSPU_Day2
{
    public partial class CallPage : PhoneApplicationPage
    {
        public CallPage()
        {
            InitializeComponent();
        }

        private void btnPhoneChoose_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
        	PhoneNumberChooserTask p = new PhoneNumberChooserTask();
			p.Completed += new System.EventHandler<Microsoft.Phone.Tasks.PhoneNumberResult>(p_Completed);
			p.Show();
        }

        private void p_Completed(object sender, Microsoft.Phone.Tasks.PhoneNumberResult e)
        {
        	if(e.TaskResult == TaskResult.OK){
				txtPhoneNumber.Text = e.PhoneNumber;
			}
        }

        private void btnCall_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
        	PhoneCallTask call =  new PhoneCallTask();
			call.PhoneNumber = txtPhoneNumber.Text;
			call.Show();
        }
    }
}
